package com.briup.smartcity.service.impl;

import com.briup.smartcity.bean.BaseLog;
import com.briup.smartcity.exception.ServiceException;
import com.briup.smartcity.mapper.BaseLogMapper;
import com.briup.smartcity.mapper.extend.BaseLogExtendMapper;
import com.briup.smartcity.service.IBaseLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseLogServiceImpl implements IBaseLogService {
    @Autowired
    private BaseLogMapper baseLogMapper;

    @Autowired
    private BaseLogExtendMapper extendMapper;

    @Override
    public PageInfo<BaseLog> pageQuery(int pageNum, int pageSize) throws ServiceException {
             PageHelper.startPage(pageNum,pageSize);
             List<BaseLog> logs = extendMapper.findAll();
             return new PageInfo<>(logs);
    }

    @Override
    public void AddbaseLog(BaseLog baseLog) throws ServiceException {
         int i = baseLogMapper.insertSelective(baseLog);
//           baseLogMapper.insert(baseLog);
    }
}
